<?php

defined('o') || exit('404 not find file'); //防跳墙

class model {
	private $tableName;
	private $db;
	private $dbname;
	private $dbengine ;
	public function __construct($val) {
		// 初始化数据库名称
		$this -> dbname = config :: create() -> dbserver['dbname']; 
		// 读取数据库引擎名称
		$this -> dbengine = config :: create() -> systems['dbengine']; 
		// 初始化数据库引擎
		$this -> db = new $this -> dbengine(config :: create() ->systems['dbdata']); 
		// 数据库连接
		$this -> db -> connect(); 
		// 初始化数据库编码
		$this -> db -> setnames(config :: create() -> dbserver['dbcode']);
                $this->tableName = $val;
	} 
	public function adddata($array_column) {
		return $this -> db -> insert($this -> tableName, $array_column);
	} 

	public function updata($array_column, $string_condition) {
		return $this -> db -> update($this -> tableName, $array_column, $string_condition);
	} 

	public function deletedata($string_condition) {
		return $this -> db -> delete_data($this -> tableName, $string_condition);
	} 

	public function querydata($array_column, $string_condition) {
		return $this -> db -> query_many($this -> tableName, $array_column, $string_condition);
	}
        public function close() {
                return $this -> db ->close();
        }

} 

?>